# -*- coding: utf-8 -*-
# @File: backend => rooms.py
# @CreateTime: 2025/8/25 14:22
# @Author: EvanZhang
# @Info: 房间模型

from tortoise import fields, models

# id | name | sb | bb | max_players | pwd_hash | status | created_at
class Room(models.Model):
    id = fields.IntField(pk=True)
    name = fields.CharField(max_length=50, unique=True, index=True, description="房间名称")
    sb = fields.IntField(description="小盲注")
    bb = fields.IntField(description="大盲注")
    max_players = fields.IntField(description="最大玩家数")
    pwd_hash = fields.CharField(max_length=128, null=True, description="房间密码哈希值")
    status = fields.CharField(max_length=20, description="房间状态", default="waiting")  # waiting, playing, finished
    created_at = fields.DatetimeField(auto_now_add=True, description="创建时间")

    class Meta:
        table = "rooms"
        description = "房间表"